package com.linln.modules.member.service.impl;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.domain.Example;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.PageRequest;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import com.linln.common.data.PageSort;
import com.linln.modules.member.domain.MemberRefund;
import com.linln.modules.member.repository.MemberRefundRepository;
import com.linln.modules.member.service.MemberRefundService;

/**
 * @author hct
 * @date 2019/09/12
 */
@Service
public class MemberRefundServiceImpl implements MemberRefundService {

    @Autowired
    private MemberRefundRepository memberRefundRepository;

    /**
     * 根据ID查询数据
     * @param id 主键ID
     */
    @Override
    @Transactional
    public MemberRefund getById(Long id) {
        return memberRefundRepository.findById(id).orElse(null);
    }
   
   
    /**
     * 获取分页列表数据
     * @param example 查询实例
     * @return 返回分页数据
     */
    @Override
    public Page<MemberRefund> getPageList(Example<MemberRefund> example) {
        // 创建分页对象
        PageRequest page = PageSort.pageRequest();
        return memberRefundRepository.findAll(example, page);
    }

    /**
     * 保存数据
     * @param MemberZan 实体对象
     */
    @Override
    public MemberRefund save(MemberRefund MemberZan) {
        return memberRefundRepository.save(MemberZan);
    }
 
    public  MemberRefund findByRefundCode(String RefundCode) {
        return memberRefundRepository.findByOrderCode(RefundCode);

    }
    
    public Integer updateRefundStatus( String RefundCode) {
        return memberRefundRepository.updateRefundStatus(RefundCode);

    }
 


}